/**
 * 
 */
package cn.hc.zhongye.core.web.vo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.hc.zhongye.frame.core.util.StringUtils;


/**
 * @author user
 *
 */
public class AjaxTreeVO {
	
	

  /*  id: node id, which is important to load remote data
    text: node text to show
    state: node state, 'open' or 'closed', default is 'open'. When set to 'closed', the node have children nodes and will load them from remote site
    checked: Indicate whether the node is checked selected.
    attributes: custom attributes can be added to a node
    children: an array nodes defines some children nodes*/
	
	
	private String id;
	
	private String text;
	
	private String iconCls;
	
	private String url;
	
	private String type;
	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	private String state = "open";  
	
	private Boolean checked;
	
	private Map<String,String> attributes = new HashMap<String,String>();
	
	private List<AjaxTreeVO> children = new ArrayList<AjaxTreeVO>();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public Boolean getChecked() {
		return checked;
	}

	public void setChecked(Boolean checked) {
		this.checked = checked;
	}

	public Map<String, String> getAttributes() {
		if ( ! StringUtils.isEmpty(url)){
			if (attributes == null){
				attributes = new HashMap<String,String>();
			}
			attributes.put("url", url);
		}
		return attributes;
	}

	public void setAttributes(Map<String, String> attributes) {
		this.attributes = attributes;
	}

	public List<AjaxTreeVO> getChildren() {
		return children;
	}

	public void setChildren(List<AjaxTreeVO> children) {
		this.children = children;
	}

	public String getIconCls() {
		return iconCls;
	}

	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	
	

}
